From: verdre Date: Mon, 19 Nov 2018 11:28:29 +0000 (+0100) Subject: workspace: Use ES6 findIndex() method for getting window index X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2^2~59 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3730314dd56510a9cff272058b5a18a97cf44b9b;p=gnome-shell.git workspace: Use ES6 findIndex() method for getting window index https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/346 --- diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 31892e56a..d8410c2e6 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1206,12 +1206,7 @@ var Workspace = class { } _lookupIndex(metaWindow) { - for (let i = 0; i < this._windows.length; i++) { - if (this._windows[i].metaWindow == metaWindow) { - return i; - } - } - return -1; + return this._windows.findIndex(w => w.metaWindow == metaWindow); } containsMetaWindow(metaWindow) { diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index accac398b..e2417010f 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -319,12 +319,7 @@ var WorkspaceThumbnail = class { } _lookupIndex(metaWindow) { - for (let i = 0; i < this._windows.length; i++) { - if (this._windows[i].metaWindow == metaWindow) { - return i; - } - } - return -1; + return this._windows.findIndex(w => w.metaWindow == metaWindow); } syncStacking(stackIndices) {